package cn.neo.support.view;

import android.content.Context;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import cn.neo.support.utils.ScreenUtil;

/**
 * Name:GuideView的小助手
 * Author: WK（wangkun@xjzhicheng.com)
 * Date: 2016-11-15
 * Describe: PLEASE TO FIXME...
 */
public class GuideViewHelper {

    /**
     * 设置指导页
     *
     * @param resID      图片资源
     * @param targetView 目标视图
     */
    public static GuideView setupGuideView(Context context, @DrawableRes int resID, @Nullable View targetView, Boolean isVFocus) {
        // 使用图片
        final ImageView iv = new ImageView(context);
        iv.setImageResource(resID);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        iv.setLayoutParams(params);

        return GuideView.Builder.newInstance(context)
                .setTargetView(targetView)//设置目标
                .setCustomGuideView(iv)
                .setOffSet4Target(isVFocus ? ScreenUtil.dip2px(context, 18) : 0, 0)//如果是vfocus右移
                .setDirction(GuideView.Direction.LEFT_BOTTOM)
                .setRadius(ScreenUtil.dip2px(context, 24))
                .setShape(GuideView.MyShape.CIRCULAR)
                .setOnclickExit(true)
                .build();
    }


}
